package com.mark.sys.repository;

import com.mark.sys.entity.dto.UserDetail;
import com.mark.sys.entity.po.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

/**
 * @Description:
 * @Author: Mark
 * @CreateDate: 2019/4/29 16:33
 * @Version: 3.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
public interface UserDetailRepository extends JpaRepository<User, Integer> {

    /**
     * 查询所有的用户信息
     * @return :
     */
    @Query(value = "SELECT new com.mark.sys.entity.dto.UserDetail(u,r) FROM User u ,Role r WHERE u.fkRoleId = r.id")
    List<UserDetail> findAllUserDetailList();
}
